function Preson(el){
    this.el = document.querySelector(el)
    this.ulLiObjs = this.el.querySelectorAll('ul li')
    this.num = 1
    this.t = null
    this.init()
}

Preson.prototype.init = function () {
    this.imgschange()
    this.fyqchange()
    this.fyqenter()
    this.fyqout()
}

Preson.prototype.imgschange = function () {
    this.t = setInterval(()=>{
        this.num++
        if(this.num>6) this.num = 1
        this.el.querySelector('img').src = `./imgs/img${this.num}.jpg`
        this.fyqchange(this.num)
    },1000)
}

Preson.prototype.fyqchange = function (num) {
    this.el.querySelector('ul li.active').className = ''
    this.el.querySelector(`ul li:nth-of-type(${this.num})`).className = 'active'
}

Preson.prototype.fyqenter = function () {
    this.ulLiObjs.forEach((item,i)=>{
        item.onmouseenter = ()=>{
            clearInterval(this.t)
            this.num =i+1
            this.el.querySelector('img').src = `./imgs/img${this.num}.jpg`
            this.fyqchange(this.num)
        }
    })
}

Preson.prototype.fyqout = function () {
    this.ulLiObjs.forEach((item,i)=>{
        item.onmouseout = ()=>{
            this.imgschange()
        }
    })
}